package com.link2room.ironhide.entity;

import com.link2room.common.entity.BaseEntity;
import org.hibernate.annotations.DynamicInsert;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * Created by sss on 2016/10/11.
 */
@Entity
@Table(name = "l2r_country")
@DynamicInsert
public class L2RCountry extends BaseEntity{
    public enum L2RCountry_{
        countryCode,countryCode2,countryCode3,countryName,countryNameEn,searchCode
    }

    /**
     * 国家代码
     */
    private String countryCode;
    /**
     * 国家代码2
     */
    private String countryCode2;
    /**
     * 国家代码3
     */
    private String countryCode3;
    /**
     * 国家名称
     */
    private String countryName;
    /**
     * 国家名称英文
     */
    private String countryNameEn;
    /**
     * 检索代码
     */
    private String searchCode;

    @Basic
    @Column(name = "country_code", nullable = true, length = 16)
    public String getCountryCode() {
        return countryCode;
    }

    public void setCountryCode(String countryCode) {
        this.countryCode = countryCode;
    }

    @Basic
    @Column(name = "country_code2", nullable = true, length = 16)
    public String getCountryCode2() {
        return countryCode2;
    }

    public void setCountryCode2(String countryCode2) {
        this.countryCode2 = countryCode2;
    }

    @Basic
    @Column(name = "country_code3", nullable = true, length = 16)
    public String getCountryCode3() {
        return countryCode3;
    }

    public void setCountryCode3(String countryCode3) {
        this.countryCode3 = countryCode3;
    }

    @Basic
    @Column(name = "country_name", nullable = false, length = 16)
    public String getCountryName() {
        return countryName;
    }

    public void setCountryName(String countryName) {
        this.countryName = countryName;
    }

    @Basic
    @Column(name = "country_name_en", nullable = true, length = 32)
    public String getCountryNameEn() {
        return countryNameEn;
    }

    public void setCountryNameEn(String countryNameEn) {
        this.countryNameEn = countryNameEn;
    }

    @Basic
    @Column(name = "search_code", nullable = true, length = 64)
    public String getSearchCode() {
        return searchCode;
    }

    public void setSearchCode(String searchCode) {
        this.searchCode = searchCode;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        L2RCountry that = (L2RCountry) o;

        if (countryCode != null ? !countryCode.equals(that.countryCode) : that.countryCode != null) return false;
        if (countryCode2 != null ? !countryCode2.equals(that.countryCode2) : that.countryCode2 != null) return false;
        if (countryCode3 != null ? !countryCode3.equals(that.countryCode3) : that.countryCode3 != null) return false;
        if (countryName != null ? !countryName.equals(that.countryName) : that.countryName != null) return false;
        if (countryNameEn != null ? !countryNameEn.equals(that.countryNameEn) : that.countryNameEn != null)
            return false;
        if (searchCode != null ? !searchCode.equals(that.searchCode) : that.searchCode != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = countryCode != null ? countryCode.hashCode() : 0;
        result = 31 * result + (countryCode2 != null ? countryCode2.hashCode() : 0);
        result = 31 * result + (countryCode3 != null ? countryCode3.hashCode() : 0);
        result = 31 * result + (countryName != null ? countryName.hashCode() : 0);
        result = 31 * result + (countryNameEn != null ? countryNameEn.hashCode() : 0);
        result = 31 * result + (searchCode != null ? searchCode.hashCode() : 0);
        return result;
    }
}
